package flc.ast.adapter;


import android.graphics.Color;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.ClassesBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class ClassesAdapter extends StkProviderMultiAdapter<ClassesBean> {


    public ClassesAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new ClassesProvider());
    }

    private class ClassesProvider extends BaseItemProvider<ClassesBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_classes;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, ClassesBean bean) {
            baseViewHolder.setText(R.id.tvClassesItemName, bean.getName());
            if (bean.isSelected()) {
                baseViewHolder.setBackgroundResource(R.id.llClassesItem, R.drawable.classes_sel);
            } else {
                baseViewHolder.setBackgroundResource(R.id.llClassesItem, R.drawable.classes_bg);

            }
        }
    }

}
